package com.dwb.controller;

import com.dwb.entity.SUser;
import com.dwb.result.Result;
import com.dwb.service.SUserService;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @Author manke
 * @Date 2020/6/27 14:16
 * @Version 0.0.1
 */
@RestController
@RequestMapping("/sUser")
@Api(value = "SUserController",description = "用户控制器")
public class SUserController {

    @Autowired
    private SUserService sUserService;

    @ApiOperation(value = "getList",notes = "获取用户列表")
    @PostMapping("/getList")
    public Result<PageInfo<SUser>> getList(@RequestBody Map<String,String> parameters){
        Result<PageInfo<SUser>> result = Result.newSuccess();
        PageInfo<SUser> list = sUserService.getList(parameters);
        result.setDataMap(list);
        return result;
    }
    @ApiOperation(value = "getInfo",notes = "查看用户详情")
    @PostMapping("/getInfo")
    public Result<Map<String,Object>> getInfo(@RequestBody Map<String,String> parameters){
        Result<Map<String,Object>> result = Result.newSuccess();
        Map<String,Object> map = sUserService.getInfo(parameters);
        result.setDataMap(map);
        return result;
    }
}
